package IOperation;

import Book.Book;
import Book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * User: wenxiwen
 * Date: 2022/4/15
 * Time: 10:47
 * Description: No Description
 */
public class Borrow implements IOperation{
    public void work(BookList bookList) {
        System.out.println("外借图书");

        System.out.println("请输入要借的书名：");
        Scanner scan = new Scanner(System.in);
        String name = scan.nextLine();
        int dex = bookList.getCount();
        for (int i = 0; i < dex; i++) {
            Book book = bookList.getBook(i);
            if(book.getName().equals(name)) {
                book.setFly(true);
                System.out.println("借阅成功！");
                return;
            }
        }
        System.out.println("没有找到你要的书籍");
    }
}